const MyPromise = require('./myPromise')

const promise1 = new MyPromise((resolve,reject)=>{
    var a = 'hello'
    setTimeout(()=>resolve(a),1000)
    resolve("失败")
})

promise1.then(value=>{
    console.log(value)
    return 'aaa'
},reason=>{
    console.log(reason)
    return 1000
})
.then()
.then()
.then(value=>{
    console.log(value)
},reason=>{
    console.log(reason)
})
// const promise2 = new MyPromise((resolve,reject)=>{
//     setTimeout(()=>{
//         resolve("成功拉2")
//     })
// })

// MyPromise.all(['a1','a2',promise1,promise2,'a4'])
// .then(value=>{
//     console.log(value)
// })

// MyPromise.resolve(22222).then(value=>console.log(value))
// MyPromise.resolve(promise2).then(value=>console.log(value))

